HAL NO_OS How to Use ¶
- group NO_OS_How_To_Use
-
How to use the OS HAL module driver ¶
Use the OS HAL driver as follows:
Create a semaphore or mutex:
Create a new semaphore instance using the HAL_OS_SemaphoreCreate() function.
Create a new mutex instance using the HAL_OS_MutexCreate() function.
A semaphore or a mutex is a simple uint32 variable that is set atomically.
Delete a semaphore or mutex:
Delete a semaphore instance using the HAL_OS_SemaphoreDelete() function.
The HAL_OS_SemaphoreDelete() API ensures that memory operations have been completed using the Data Memory Barrier instruction “__DMB()” before resetting the semaphore.
Delete a mutex instance using the HAL_OS_MutexDelete() function.
The HAL_OS_MutexDelete() API ensures that memory operations have been completed using the Data Memory Barrier instruction “__DMB()” before resetting the semaphore.
Take the semaphore or mutex when required:
Take a semaphore using the HAL_OS_SemaphoreTake() function.
The HAL_OS_SemaphoreTake() API allows setting the semaphore variable atomically using exclusive loading and storage instructions “__LDREXW” and “__STREXW”.
Take a mutex using the HAL_OS_MutexTake() function, which behaves the same as HAL_OS_SemaphoreTake().
Release the semaphore or mutex:
Release a semaphore using the HAL_OS_SemaphoreRelease() function.
The HAL_OS_SemaphoreRelease() API ensures that memory operations have been completed using the Data Memory Barrier instruction “__DMB()” before resetting the semaphore.
Release a mutex using the HAL_OS_MutexRelease() function, which behaves the same as HAL_OS_SemaphoreRelease().